package com.ruyuan.ingestion.parser.hbase;

import com.ruyuan.ingestion.parser.EventAttendeesParser;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

public class HBaseEventAttendeesParser extends EventAttendeesParser<Put> {
    @Override
    public Put parse(String[] fields) {
        //rowKey
        Put put = new Put(Bytes.toBytes(fields[0] +"-"+ fields[1] + "."+fields[2]));
        put = put.addColumn(Bytes.toBytes("euat"),Bytes.toBytes("event_id"),Bytes.toBytes(fields[0]));
        put = put.addColumn(Bytes.toBytes("euat"),Bytes.toBytes("user_id"),Bytes.toBytes(fields[1]));
        put = put.addColumn(Bytes.toBytes("euat"),Bytes.toBytes("attend_type"),Bytes.toBytes(fields[2]));
        return put;
    }
}
